package com.zrrd.yunchmall.product.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zrrd.yunchmall.product.service.IProductAttributeCategoryService;
import com.zrrd.yunchmall.util.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 产品属性分类表 前端控制器
 * </p>
 *
 * @author YeKong
 * @since 2024-01-15
 */
@RestController
@RequestMapping("/productAttribute/category")
@Api(tags = "商品服务-商品属性类别")
public class ProductAttributeCategoryController {
@Autowired
    private IProductAttributeCategoryService attributeCategoryService;
@ApiOperation("查询列表")
    @GetMapping("/list")
    public ResponseResult list ( int pageNum,
                                int pageSize,
                                String keyword){
    QueryWrapper queryWrapper = new QueryWrapper();
    if (!StringUtils.isEmpty(keyword)){
        queryWrapper.like("name",keyword);
    }
    return new ResponseResult(200,"查询成功",
            attributeCategoryService.page(new Page<>(pageNum,pageSize),queryWrapper));
}
}
